﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace menustrip菜单控件
{
    public partial class Editor : Form
    {
        private OpenFileDialog od = new OpenFileDialog();
        private SaveFileDialog sd = new SaveFileDialog();
        private bool richboxTextHasChanged = false;
        public Editor()
        {
            InitializeComponent();
        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void Editor_Load(object sender, EventArgs e)
        {

        }

        private void 打印ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 主菜单ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
        {
          
        }

        private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
        {
           

        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {

        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            od.ShowDialog();
            if (od.FileName != "")
            {

                richTextBox1.LoadFile(od.FileName, RichTextBoxStreamType.PlainText);
                this.Text = od.FileName + "-记事本";

            }
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            if (od.FileName != "")
            {
                richTextBox1.SaveFile(od.FileName, RichTextBoxStreamType.PlainText);
            }
            else
                MessageBox.Show("请先打开文本文件", "信息提示", MessageBoxButtons.OK);
        }
    }
}
